#include "process.h"
#include <string.h>
#include <stdio.h>

#define NUM 101
#define SIGN '='

void Downprocess(double TotalSize, double DownSpeed, double tmpDownSpeed)
{
    char buffer[NUM];
    memset(buffer, 0, sizeof(buffer));
    const char* postsign = "|\\-/";
    int len = strlen(postsign);
    int cnt = (int)(DownSpeed*100/TotalSize);
    int i = 0;
    for(; i <= cnt; ++i)
        buffer[i] = SIGN;
    printf("[%-100s][%-2d%%][%c][当前下载速度:%-.2f]\r", buffer, cnt+1, postsign[cnt%len], tmpDownSpeed);
    fflush(stdout);
}
